﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Surface.Core;
using Microsoft.Surface.Core.Manipulations;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace Sublimation
{
    public class MenuItemSurf : MenuItem
    {
        protected Contact itemContact;
        public Contact ItemContact
        {
            set { itemContact = value; }
            get { return itemContact; }
        }

        public MenuItemSurf(WorldProperties worldProperties, GameObject parent, Vector2 position, Vector2 origin)
            : base(worldProperties, parent)
        {
            this.position = position;
            this.origin = origin;
            itemStatus = MenuItemStatus.Unselected;
        }

        // checks if it menuitem contains the contact. 
        public bool Contains(Contact aContact)
        {
            Vector2 point = new Vector2(aContact.X,aContact.Y);
            float curRotation = this.Rotation;
            
            // if the item is rotated
            if (curRotation != 0)
            {
                point = RotatePoint(this.Position, (float)(2 * Math.PI) - curRotation, point);
            }

            return ContainsPoint(point);
        }
    }
}
